$(function () {
   obj.init();
});
var obj = new function () {
    'use strict';
    return {
        form:null,
        dataGrid:null,
        depTag:null,
        init:function () {
            this.depTag = xhTool.getQuery('depTag');
            this.dataGrid = new xhDataGrid($('#overList'));
            this.dataGrid.parseToolbar().init(baseUrl+'hrm/attendance/getOverTime', this.funObj().getParams());
            this.listener();
        },
        listener:function () {
            var $this = this;
            $('#bt_list_search').click(function () {
                $this.funObj().doSearch();
            });
            xhTool.bindDocKeyDown($('#bt_list_search'));
            //导出
            $('#excel_export').click(function () {
                $this.funObj().exportExcel();
            })
        },
        funObj:function () {
            var $this = this;
            return {
                doSearch:function () {
                    $this.dataGrid.reload($this.funObj().getParams());
                },
                exportExcel:function () {
                    window.open(baseUrl+'hrm/attendance/exportOverWork?' + xhTool.parseParam($this.funObj().getParams()));
                    $this.funObj().doSearch();
                },
                getParams:function () {
                    return {
                        key: xhExtra.getValue($('#list_search')),
                        startTime:xhExtra.getValue($('#List_Search_StartTime')),
                        endTime:xhExtra.getValue($('#List_Search_EndTime')),
                        depTag:$this.depTag
                    }
                }
            }
        }
    }
};